//创建用户相关的小仓库
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { respLoginData } from '@/api/types/user'
// 创建用户小仓库

export const useUserStore = defineStore(
  'User',
  () => {
    const userInfo = ref<Partial<respLoginData>>({})

    const setUserInfo = (data: respLoginData) => {
      userInfo.value = data
    }

    const removeUserInfo = () => {
      userInfo.value = {}
    }
    return { userInfo, setUserInfo, removeUserInfo }
  },
  {
    persist: true,
  },
)
